/*
 PureMVC Javascript for Objs port by Frederic Saunier Saunier <frederic.saunier@puremvc.org>
 PureMVC - Copyright(c) 2006-2011 Futurescale, Inc., Some rights reserved.
 Your reuse is governed by the Creative Commons Attribution 3.0 License
*/

/**
 * Test the PureMVC Mediator class.
 * 
 * @see puremvc.Mediator Mediator
 */
var MediatorTest = new YUITest.TestCase
(
	{
       /**
         * The name of the test case - if not provided, one is automatically
         * generated by the YUITest framework.
         * 
         * @type {String}
         * @private
         */
        name: "PureMVC Mediator class tests",  

        /**
         * Sets up data that is needed by each test.
         */
        setUp: function()
		{
        },
        
        /**
         * Cleans up everything that was created by setUp().
         */
        tearDown: function()
		{
        },

  		/**
  		 * Tests if constructing the Mediator also call its super by testing
  		 * for the existence of its <code>Notifier</code> superclass facade
  		 * instance.
  		 */
  		testConstructor: function()
		{
			// Create a new subclass of Notifier and verify that its facade
			// has well been created
   			var mediatorTestSub/*MediatorTestSub*/ = new MediatorTestSub();     

   			// test assertions
   			YUITest.Assert.isTrue
			(
				mediatorTestSub.hasFacade(),
				"Expecting mediatorTestSub.hasFacade() === true"
			);
   		},

		/**
  		 * Tests getting the name using Mediator class accessor method.
  		 */
  		testNameAccessor: function()
		{
    		var Mediator = Objs.get("puremvc.Mediator");

			// Create a new Mediator and use accessors to set the mediator name 
   			var mediator/*Mediator*/ = new Mediator();
   			
   			// test assertions
   			YUITest.Assert.areEqual
			(
				Mediator.NAME,
				mediator.getMediatorName(),
				"Expecting mediator.getMediatorName() == Mediator.NAME"
			);
   		},

  		/**
  		 * Tests getting the name using Mediator class accessor method. 
  		 */
  		testViewAccessor: function()
		{
    		var Mediator = Objs.get("puremvc.Mediator");

			// Create a view object
			var view/*Object*/ = new Object();
			
			// Create a new Proxy and use accessors to set the proxy name 
   			var mediator/*Mediator*/ = new Mediator( Mediator.NAME, view );
			   			
   			// test assertions
   			YUITest.Assert.isNotNull
			(
				mediator.getViewComponent(),
				"Expecting mediator.getViewComponent() !== null"
			);
   		}

  	}
);